using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;

namespace GuavaLib
{
    public static class GLaunchClass
    {
        public static Type RetrieveTypeFromFile(string strFileName, Assembly call)
        {
            Assembly asm;
            string className;

            if (strFileName.Contains("~"))
            {
                string[] ls = strFileName.Split('~');
                asm = Assembly.LoadFile(ls[0]);
                className = ls[1];
            }
            else
            {
                asm = call;
                className = strFileName;
            }
            
            if (asm != null)
            {
                Type[] asmTypes = asm.GetTypes();
                foreach (Type t in asmTypes) if (className.CompareTo(t.Name) == 0) return t;
            }
            return null;
        }
    }
}
